<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>load model</title>
</head>

<body>
    <script src="../../test/e2e/js/AssetTool.js"></script>
    <script src="../../test/e2e/js/LightBoxesTool.js"></script>
    <script src="../../test/e2e/js/LightTool.js"></script>
    <script src="../../test/e2e/js/CameraTool.js"></script>
    <script src="../../test/e2e/js/LightMaterialTool.js"></script>
    <script src="../../dist/wd.js"></script>

    <script>
        window.onload = function () {
            return AssetTool.loadConfig(["../config/setting.json", "../config/"], null, function () {
                return AssetTool.loadGLB(
                    "../../../../test/e2e/asset/glb/CesiumMilkTruck.glb"
                )
                    .then((glb) => {
                        var wdb = wd.convertGLBToWDB(glb);

                        return wd.assembleWholeWDB(wdb,
                            true, true, true, true, true,
                            wd.unsafeGetState())
                            .forEach(([state, _, sceneGameObject]) => {
                                wd.setState(state);
                            })
                            .then(() => {
                                return initSample(wd.unsafeGetState());
                            })

                    });

            });

            function initSample(state) {
                var state = AssetTool.createLightsAndCamera(state);

                wd.startDirector(state);
            }
        };
    </script>
</body>

</html>